﻿@model MODEL.View.Products.AddProductRequest
@{
    ViewBag.Title = "添加产品";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@Scripts.Render("~/media/fileupload/js")
@Styles.Render("~/media/fileupload/css")
@section jquery_ready{
FormFileUpload.init();
}
<script src="~/Scripts/product.js"></script>
<script src="~/Scripts/Base/ds-category.js"></script>
  
<div class="row-fluid">
    <div class="span12">
        @using (Ajax.BeginForm("AddProduct", "Product", new AjaxOptions() { HttpMethod = "post", OnSuccess = "AddProductSubmitSuccess" }, new { id = "table_proudctInfo", @class = "form-horizontal span10" }))
        {
            @Html.AntiForgeryToken() 
            <h4 class="form-section">产品信息</h4>
            <div class="control-group">
                @Html.LabelFor(s => s.CategoryID, new { @class = "control-label" })
                @Html.HiddenFor(s => s.CategoryID)
                <div class="controls">
                    @Html.TextBox("FullCategoryName", "", new { style = "background-color: #f4f4f4;", @class = "m-wrap span12" })
                    @{Html.RenderAction("GetPartialCategory", "Home", new { pid = 0 });}
                </div>
            </div>
            <div class="control-group">
                @Html.LabelFor(s => s.Code, new { @class = "control-label" })
                <div class="controls">
                    @Html.BsTextBoxFor(s => s.Code, "SKU", "m-wrap span6")
                    <span style="color: red">@Html.ValidationMessageFor(s => s.Code)</span>
                    <span style="color: #ff6a00" id="sku_remark"></span>
                </div>
            </div>
                    
            <div class="control-group">
                @Html.LabelFor(s => s.Name, new { @class = "control-label" })
                <div class="controls">
                    @Html.BsTextBoxFor(s => s.Name, "产品中文名称", "m-wrap span12")
                    <span style="color: red">@Html.ValidationMessageFor(s => s.Name)</span>
                </div>
            </div>
            <div class="control-group">
                @Html.LabelFor(s => s.ProductDesc, new { @class = "control-label" })
                <div class="controls">
                    @Html.TextAreaFor(s => s.ProductDesc, new { @class = "m-wrap span12", rows = "6" })
                    <span style="color: red">@Html.ValidationMessageFor(s => s.ProductDesc)</span>
                </div>
            </div>
            <div class="control-group">
                @Html.LabelFor(s => s.ProductPackage, new { @class = "control-label" })
                <div class="controls">
                    @Html.TextAreaFor(s => s.ProductPackage, new { @class = "m-wrap span12", rows = "6" })
                    <span style="color: red">@Html.ValidationMessageFor(s => s.ProductPackage)</span>
                </div>
            </div>
                    
            <div class="row-fluid">
                <div class="span4">
                    <div class="control-group">
                        @Html.LabelFor(s => s.ProductTypeID, new { @class = "control-label" })
                        <div class="controls">
                            @Html.DropDownListFor(s => s.ProductTypeID, ViewBag.ProductType as List<SelectListItem>, new { @class = "m-wrap span12" })
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <div class="control-group">
                        @Html.LabelFor(s => s.ProductSpecID, new { @class = "control-label" })
                        <div class="controls">
                            @Html.DropDownListFor(s => s.ProductSpecID, ViewBag.ProductSpec as List<SelectListItem>, new { @class = "m-wrap span12" })
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <div class="control-group">
                        @Html.LabelFor(s => s.ProductStatusID, new { @class = "control-label" })
                        <div class="controls">
                            @Html.DropDownListFor(s => s.ProductStatusID, ViewBag.ProductStatu as List<SelectListItem>, new { @class = "m-wrap span12" })
                        </div>
                    </div>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span4">
                    <div class="control-group">
                        @Html.LabelFor(s => s.TransportType, new { @class = "control-label" })
                        <div class="controls">
                            @Html.DropDownListFor(s => s.TransportType, ViewBag.TransportType as List<SelectListItem>, new { @class = "m-wrap span12" })
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <div class="control-group">
                        @Html.LabelFor(s => s.Warehouse, new { @class = "control-label" })
                        <div class="controls">
                            @Html.DropDownListFor(s => s.Warehouse, ViewBag.Stock as List<SelectListItem>, new { @class = "m-wrap span12" })
                        </div>
                    </div>
                </div>
            </div> 
            <div class="control-group">
                @Html.LabelFor(s => s.ContrabandIdList, new { @class = "control-label" })
                <div class="controls">
                    @Html.CheckBoxListFor(s => s.ContrabandIdList, ViewBag.Contraband as List<SelectListItem>, true)
                </div>
            </div> 
            <div class="control-group">
                @Html.LabelFor(s => s.IsHighValue, new { @class = "control-label" })
                <div class="controls">
                    <label class="radio">
                        @Html.RadioButtonFor(s => s.IsHighValue, true) 是
                    </label>
                    <label class="radio">
                        @Html.RadioButtonFor(s => s.IsHighValue, false) 否
                    </label>
                </div>
            </div>
            <div class="control-group">
                @Html.LabelFor(s => s.IsAdorn, new { @class = "control-label" })
                <div class="controls">
                    <label class="radio">
                        @Html.RadioButtonFor(s => s.IsAdorn, true) 是
                    </label>
                    <label class="radio">
                        @Html.RadioButtonFor(s => s.IsAdorn, false) 否
                    </label>
                </div>
            </div>
            <h4 class="form-section">产品翻译</h4>
            <div class="control-group">
                @Html.LabelFor(s => s.LanguageTypeID, new { @class = "control-label" })
                <div class="controls">
                    @Html.DropDownListFor(s => s.LanguageTypeID, ViewBag.LanguageType as List<SelectListItem>, new { @class = "m-wrap span12" })
                </div>
            </div>
            <div class="control-group">
                @Html.LabelFor(s => s.ProductSubject, new { @class = "control-label" })
                <div class="controls">
                    @Html.BsTextBoxFor(s => s.ProductSubject, "产品外文名称主题", "m-wrap span12")
                    <span style="color: red">@Html.ValidationMessageFor(s => s.ProductSubject)</span>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span4">
                    <div class="control-group">
                        @Html.LabelFor(s => s.KeyWords1, new { @class = "control-label" })
                        <div class="controls">
                            @Html.BsTextBoxFor(s => s.KeyWords1, "KeyWords1", "m-wrap span12")
                            <span style="color: red">@Html.ValidationMessageFor(s => s.KeyWords1)</span>
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <div class="control-group">
                        <div class="controls">
                            @Html.BsTextBoxFor(s => s.KeyWords2, "KeyWords2", "m-wrap span12")
                            <span style="color: red">@Html.ValidationMessageFor(s => s.KeyWords2)</span>
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <div class="control-group">
                        <div class="controls">
                            @Html.BsTextBoxFor(s => s.KeyWords3, "KeyWords3", "m-wrap span12")
                            <span style="color: red">@Html.ValidationMessageFor(s => s.KeyWords3)</span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span4">
                    <div class="control-group">
                        <div class="controls">
                            @Html.BsTextBoxFor(s => s.KeyWords4, "KeyWords4", "m-wrap span12")
                            <span style="color: red">@Html.ValidationMessageFor(s => s.KeyWords4)</span>
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <div class="control-group">
                        <div class="controls">
                            @Html.BsTextBoxFor(s => s.KeyWords5, "KeyWords5", "m-wrap span12")
                            <span style="color: red">@Html.ValidationMessageFor(s => s.KeyWords5)</span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="control-group">
                @Html.LabelFor(s => s.ProductTitle, new { @class = "control-label" })
                <div class="controls">
                    @Html.BsTextBoxFor(s => s.ProductTitle, "产品外文名称", "m-wrap span12")
                    <span style="color: red">@Html.ValidationMessageFor(s => s.ProductTitle)</span>
                </div>
            </div>
            <div class="control-group">
                @Html.LabelFor(s => s.ProductDescription, new { @class = "control-label" })
                <div class="controls">
                    @Html.TextAreaFor(s => s.ProductDescription, new { @class = "m-wrap span12", rows = "6" })
                    <span style="color: red">@Html.ValidationMessageFor(s => s.ProductDescription)</span>
                </div>
            </div>
            <div class="control-group">
                @Html.LabelFor(s => s.ProductExplanation, new { @class = "control-label" })
                <div class="controls">
                    @Html.TextAreaFor(s => s.ProductExplanation, new { @class = "m-wrap span12", rows = "6" })
                    <span style="color: red">@Html.ValidationMessageFor(s => s.ProductExplanation)</span>
                </div>
            </div> 
            <div class="control-group">
                @Html.LabelFor(s => s.BulletPoint1, new { @class = "control-label" })
                <div class="controls">
                    @Html.BsTextBoxFor(s => s.BulletPoint1, "BulletPoint1", "m-wrap span12")
                    <span style="color: red">@Html.ValidationMessageFor(s => s.BulletPoint1)</span>
                </div>
            </div> 
            <div class="control-group">
                <div class="controls">
                    @Html.BsTextBoxFor(s => s.BulletPoint2, "BulletPoint2", "m-wrap span12")
                    <span style="color: red">@Html.ValidationMessageFor(s => s.BulletPoint2)</span>
                </div>
            </div> 
            <div class="control-group">
                <div class="controls">
                    @Html.BsTextBoxFor(s => s.BulletPoint3, "BulletPoint3", "m-wrap span12")
                    <span style="color: red">@Html.ValidationMessageFor(s => s.BulletPoint3)</span>
                </div>
            </div> 
            <div class="control-group">
                <div class="controls">
                    @Html.BsTextBoxFor(s => s.BulletPoint4, "BulletPoint4", "m-wrap span12")
                    <span style="color: red">@Html.ValidationMessageFor(s => s.BulletPoint4)</span>
                </div>
            </div> 
            <div class="control-group">
                <div class="controls">
                    @Html.BsTextBoxFor(s => s.BulletPoint5, "BulletPoint5", "m-wrap span12")
                    <span style="color: red">@Html.ValidationMessageFor(s => s.BulletPoint5)</span>
                </div>
            </div>

            <h4 class="form-section">产品属性</h4>
            <div class="control-group">
                @Html.LabelFor(s => s.CategoryID, new { @class = "control-label" })
                <div class="controls">
                    @Html.DropDownListFor(s => s.CategoryID, ViewBag.LanguageType as List<SelectListItem>, new { @class = "m-wrap span12" })
                </div>
            </div>
            <div class="row-fluid">
                <div class="span4">
                    <div class="control-group">
                        @Html.LabelFor(s => s.Length, new { @class = "control-label" })
                        <div class="controls">
                            @Html.BsTextBoxFor(s => s.Length, "Length", "m-wrap span12")
                            <span style="color: red">@Html.ValidationMessageFor(s => s.BulletPoint5)</span>
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <div class="control-group">
                        @Html.LabelFor(s => s.Width, new { @class = "control-label" })
                        <div class="controls">
                            @Html.BsTextBoxFor(s => s.Width, "Width", "m-wrap span12")
                            <span style="color: red">@Html.ValidationMessageFor(s => s.BulletPoint5)</span>
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <div class="control-group">
                        @Html.LabelFor(s => s.Height, new { @class = "control-label" })
                        <div class="controls">
                            @Html.BsTextBoxFor(s => s.Height, "Height", "m-wrap span12")
                            <span style="color: red">@Html.ValidationMessageFor(s => s.BulletPoint5)</span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span4">
                    <div class="control-group">
                        @Html.LabelFor(s => s.Girth, new { @class = "control-label" })
                        <div class="controls">
                            @Html.BsTextBoxFor(s => s.Girth, "Girth", "m-wrap span12")
                            <span style="color: red">@Html.ValidationMessageFor(s => s.BulletPoint5)</span>
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <div class="control-group">
                        @Html.LabelFor(s => s.Volume, new { @class = "control-label" })
                        <div class="controls">
                            @Html.BsTextBoxFor(s => s.Volume, "Volume", "m-wrap span12")
                            <span style="color: red">@Html.ValidationMessageFor(s => s.BulletPoint5)</span>
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <div class="control-group">
                        @Html.LabelFor(s => s.Bulkfactor, new { @class = "control-label" })
                        <div class="controls">
                            @Html.BsTextBoxFor(s => s.Bulkfactor, "Bulkfactor", "m-wrap span12")
                            <span style="color: red">@Html.ValidationMessageFor(s => s.Bulkfactor)</span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span4">
                    <div class="control-group">
                        @Html.LabelFor(s => s.Cost, new { @class = "control-label" })
                        <div class="controls">
                            @Html.BsTextBoxFor(s => s.Cost, "Cost", "m-wrap span12")
                            <span style="color: red">@Html.ValidationMessageFor(s => s.Cost)</span>
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <div class="control-group">
                        @Html.LabelFor(s => s.Weight, new { @class = "control-label" })
                        <div class="controls">
                            @Html.BsTextBoxFor(s => s.Weight, "Weight", "m-wrap span12")
                            <span style="color: red">@Html.ValidationMessageFor(s => s.Weight)</span>
                        </div>
                    </div>
                </div>
            </div>

            <h4 class="form-section">产品图片</h4> 
            <a class=" btn green" data-toggle="modal" href="#images_upload">添加本地图片</a>
                        
            <div class="form-actions">
                <button type="submit" class="btn blue">Submit</button>
                <button type="button" class="btn">Cancel</button>
            </div> 
            
        }
    </div>
</div>

<div id="images_upload" class="modal hide fade" tabindex="-1" data-focus-on="input:first">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
        <h5>本地上传图片</h5>
    </div>
    <div class="modal-body">
        <div class="row-fluid">
            <div class="span12">
                <form id="fileupload" enctype="multipart/form-data" action="/Upload/UploadHandler.ashx">
                    <div class="row-fluid fileupload-buttonbar">
                        <div class="span12">
                            <span class="btn green fileinput-button">
                                <i class="icon-plus icon-white"></i>
                                <span>添加图片</span>
                                <input type="file" name="files[]" multiple>
                            </span>
                            <button type="submit" class="btn blue start">
                                <i class="icon-upload icon-white"></i>
                                <span>开始上传</span>
                            </button>
                            <button type="reset" class="btn yellow cancel">
                                <i class="icon-ban-circle icon-white"></i>
                                <span>取消上传</span>
                            </button>
                            <button type="button" class="btn red delete">
                                <i class="icon-trash icon-white"></i>
                                <span>删 除</span>
                            </button>
                            <input type="checkbox" class="toggle fileupload-toggle-checkbox">全选
                        </div>
                        <div class="span5 fileupload-progress fade">
                            <div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
                                <div class="bar" style="width: 0%;"></div>
                            </div>
                            <div class="progress-extended">&nbsp;</div>
                        </div>
                    </div>
                    <div class="fileupload-loading"></div>
                    <br>
                    <table role="presentation" class="table table-striped">
                        <tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody>
                    </table>
                </form>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span12">
                <script id="template-upload" type="text/x-tmpl"> 
							{% for (var i=0, file; file=o.files[i]; i++) { %} 
							    <tr class="template-upload fade"> 
							        <td class="preview"><span class="fade"></span></td> 
							        <td class="name"><span>{%=file.name%}</span></td> 
							        <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td> 
							        {% if (file.error) { %} 
							            <td class="error" colspan="2"><span class="label label-important">Error</span> {%=file.error%}</td> 
							        {% } else if (o.files.valid && !i) { %} 
							            <td> 
							                <div style='width:60px;'  class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="bar" style="width:0%;"></div></div>
							            </td> 
							            <td class="start">{% if (!o.options.autoUpload) { %} 
							                <button class="btn"> 
							                    <i class="icon-upload icon-white"></i> 
							                    <span>Start</span> 
							                </button> 
							            {% } %}</td> 
							        {% } else { %} 
							            <td colspan="2"></td> 
							        {% } %} 
							        <td class="cancel">{% if (!i) { %} 
							            <button class="btn red"> 
							                <i class="icon-ban-circle icon-white"></i> 
							                <span>Cancel</span> 
							            </button> 
							        {% } %}</td> 
							    </tr> 
							{% } %} 
                </script>
                <script id="template-download" type="text/x-tmpl"> 
							{% for (var i=0, file; file=o.files[i]; i++) { %} 
							    <tr class="template-download fade"> 
							        {% if (file.error) { %} 
							            <td></td> 
							            <td class="name"><span>{%=file.name%}</span></td> 
							            <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td> 
							            <td class="error" colspan="2"><span class="label label-important">Error</span> {%=file.error%}</td> 
							        {% } else { %} 
							            <td class="preview"> 
							            {% if (file.thumbnail_url) { %} 
							                <a class="fancybox-button" data-rel="fancybox-button" href="{%=file.url%}" title="{%=file.name%}"> 
							                <img width="75" height="80" src="{%=file.thumbnail_url%}"> 
							                </a> 
							            {% } %}</td> 
							            <td class="name"> 
							                <a href="{%=file.url%}" title="{%=file.name%}" data-gallery="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}">{%=file.name%}</a>
							            </td> 
							            <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td> 
							            <td colspan="2"></td> 
							        {% } %} 
							        <td class="delete"> 
							            <button class="btn red" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}"{% if (file.delete_with_credentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
							                <i class="icon-trash icon-white"></i> 
							                <span>Delete</span> 
							            </button> 
							            <input type="checkbox" class="fileupload-checkbox hide" name="delete" value="1"> 
							        </td> 
							    </tr> 
							{% } %} 
                </script>
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <button type="button" data-dismiss="modal" class="btn">Close</button>
        <button type="button" class="btn red">Ok</button>
    </div>
</div>


